import {createStore} from 'vuex'

export default createStore({
    state() {
        return {
            userInfo: {
                name: "陶品奇",
                age: 22,
                address: "衡阳"
            }
        }
    },
    getters: {},
    mutations: {
        changeUserInfoMutation(state, name) {
            state.userInfo.name = name
        }
    },
    actions: {
        changeUserInfoAction(context, name) {
            setTimeout(() => {
                context.commit("changeUserInfoMutation", name)
            }, 1000)
        }
    },
    modules: {}
})
